/**
  ******************************************************************************
  * @file   log.h
  * @author Administrator
  * @since  2024/7/30
  *
  * @brief  Header file of hardware/peripheral driver for Xxx(Hardware/Simulation-Implemented).
  *
  ******************************************************************************
  */
#ifndef CALCELF_LOG_H
#define CALCELF_LOG_H

#include "stdio.h"

enum log_levels {
    LOG_LVL_ERROR   = 0,
    LOG_LVL_WARNING = 1,
    LOG_LVL_INFO    = 2,
    LOG_LVL_DEBUG   = 3,
};

#define LOG_DEBUG(expr ...)     log_output(LOG_LVL_DEBUG,   __FILE__, __LINE__, __func__, expr)

#define LOG_INFO(expr ...)      log_output(LOG_LVL_INFO,    __FILE__, __LINE__, __func__, expr)

#define LOG_WARNING(expr ...)   log_output(LOG_LVL_WARNING, __FILE__, __LINE__, __func__, expr)

#define LOG_ERROR(expr ...)     log_output(LOG_LVL_ERROR,   __FILE__, __LINE__, __func__, expr)

void log_output(enum log_levels level, const char *file, unsigned line, const char *function,
                const char *format, ...);

#endif //CALCELF_LOG_H
